<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

/**
 * Cron Controller.
 * 
 * @class     Cron
 * @author    Iqbal
 * @version   1.0.0
 * @copyright Copyright (c) 2014 IPPI (http://www.ippi.or.id)
 */
class Cron extends CI_Controller {
    /**
	 * Constructor.
	 */
	public function __construct()
    {
        parent::__construct();
        
        // Load model
        $this->load->model('model_cron', 'm_cron', TRUE);
    }
    
    /**
	 * CRON JOB : Clear chat history, twice a day
	 */
    public function clear_chat_history(){
        $this->benchmark->mark('started');
        ippi_log('CRON_JOB_CLEAR_CHAT_HISTORY', 'STARTED', '0.0000');
        
        $today  = date('Y-m-d');
        $this->m_cron->delete_chat_message($today);
  		
  		$this->benchmark->mark('ended');
        ippi_log('CRON_JOB_CLEAR_CHAT_HISTORY', 'ENDED', $this->benchmark->elapsed_time('started', 'ended'));
    }
}

/* End of file cron.php */
/* Location: ./application/controllers/cron.php */